package org.example.c1;

import lombok.extern.slf4j.Slf4j;

import java.util.Objects;

/**
 * @author liu-rui
 * @date 2020/5/27 下午2:03
 * @description
 * 测试Thread.holdLock方法
 * @since
 */
@Slf4j
public class Demo8 {
    public static void main(String[] args) {
        Thread t = new Thread(()->{
            log.info("begin {}",Thread.holdsLock(Demo8.class));

            synchronized (Demo8.class){
                log.info("sync {}",Thread.holdsLock(Demo8.class));
            }

            log.info("end {}",Thread.holdsLock(Demo8.class));
        },"t1");

        t.start();
    }
}
